package service;

import java.util.ArrayList;

import org.apache.ibatis.session.SqlSession;

import bean.OrderRecipients;
import mapper.OrderRecipientsMapper;
import util.MybatisUtil;

public class OrderRecipientsServiceImpl implements OrderRecipientsService{

	@Override
	public ArrayList<OrderRecipients> getAllOrderRecipients(int userId) {
		SqlSession sqlSession = MybatisUtil.getSqlSession();
		OrderRecipientsMapper orderRecipientsMapper = sqlSession.getMapper(OrderRecipientsMapper.class);
		ArrayList<OrderRecipients> list = orderRecipientsMapper.getAllOrderRecipients(userId);
		System.out.println(list);
		sqlSession.commit();
		return list;
	}

	@Override
	public OrderRecipients getOneOrderRecipients(int userId, int orderRecipientsId) {
		SqlSession sqlSession = MybatisUtil.getSqlSession();
		OrderRecipientsMapper orderRecipientsMapper = sqlSession.getMapper(OrderRecipientsMapper.class);
		OrderRecipients orderRecipients = orderRecipientsMapper.getOneOrderRecipients(orderRecipientsId);
		sqlSession.commit();
		return orderRecipients;
	}

}
